<?php require __DIR__ . '/inc_header.tpl.php';?>

<div class="rj-head">
	<h1>PHPwork安装向导 —— 环境测试</h1>
</div>

<div class="rj-body">
	<div class="tt"></div>
	<div class="rj_form">
		<legend>功能支持检测</legend>
		<div class="formitm">
			<label class="lab">操作系统：</label>
			<div class="ipt">
				<?php echo PHP_OS ?> &nbsp; &nbsp;
				<span  style='color:green'><b>√</b></span>
			</div>
		</div>
		<div class="formitm">
			<label class="lab">PHP版本：</label>
			<div class="ipt">
				<?php echo phpversion(); ?> &nbsp; &nbsp;
				<?php 
				if (phpversion() < '7.2'){
					echo "<span  style='color:red'><b>×</b></span>";
				} else {
					echo "<span  style='color:green'><b>√</b></span>";
				} 
				?>
			</div>
		</div>
		<div class="formitm">
			<label class="lab">附件上传：</label>
			<div class="ipt">
				<?php 
				if(@ini_get('file_uploads'))	echo  ini_get('upload_max_filesize');
				?> &nbsp; &nbsp;
				<?php 
				if (@ini_get('file_uploads')){
					echo "<span  style='color:green'><b>√</b></span>";
				} else {
					echo "<span  style='color:red'><b>×</b></span>";
					$this->is_step=false;
				} 
				?>
			</div>
		</div>
		<div class="formitm">
			<label class="lab">GD库：</label>
			<div class="ipt">
				<?php
				//GD库检测
				$tmp = function_exists('gd_info') ? gd_info() : array();
				if(!empty($tmp['GD Version'])){
					echo $tmp['GD Version'];
				}
				?>  &nbsp; &nbsp;
				<?php 
				if (!empty($tmp['GD Version'])){
					echo "<span  style='color:green'><b>√</b></span>";
				} else {
					echo "<span  style='color:red'><b>×</b></span>";
					$this->is_step=false;
				} 
				?>
			</div>
		</div>


		<legend>函数支持检测</legend>
	
		<div class="formitm">
			<label class="lab">PDO：</label>
			<div class="ipt">
				&nbsp; &nbsp;
				<?php
				if (class_exists('pdo')){
					echo "<span style='color:green'><b>√</b></span>";
				} else {
					echo "<span  style='color:red'><b>×</b></span>";
					$this->is_step=false;
				}
				?>
			</div>
		</div>     
		<div class="formitm">
			<label class="lab">pathinfo：</label>
			<div class="ipt"> &nbsp; &nbsp;
				<?php
				if (function_exists('pathinfo')){
					echo "<span style='color:green'><b>√</b></span>";
				} else {
					echo "<span style='color:red'><b>×</b></span>";
					$this->is_step=false;
				}
				?>
			</div>
		</div>


		<!-- <legend>微信公众号支持检测</legend> -->
	
		<div class="formitm">
			<label class="lab">cURL扩展：</label>
			<div class="ipt">
				&nbsp; &nbsp;
				<?php
				if (function_exists('curl_init')){
					echo "<span style='color:green'><b>√</b></span>";
				} else {
					echo "<span  style='color:red'><b>×</b></span>";
					$this->is_step=false;
				}
				?>
			</div>
		</div>
		<div class="formitm">
			<label class="lab">OpenSSL扩展：</label>
			<div class="ipt">
				&nbsp; &nbsp;
				<?php
				if (function_exists('openssl_open')){
					echo "<span style='color:green'><b>√</b></span>";
				} else {
					echo "<span  style='color:red'><b>×</b></span>";
					$this->is_step=false;
				}
				?>
			</div>
		</div>			
		<div class="formitm">
			<label class="lab">SimpleXML扩展：</label>
			<div class="ipt">
				&nbsp; &nbsp;
				<?php
				if (function_exists('simplexml_load_file')){
					echo "<span style='color:green'><b>√</b></span>";
				} else {
					echo "<span  style='color:red'><b>×</b></span>";
					$this->is_step=false;
				}
				?>
			</div>
		</div>		

		<!--
		<div class="formitm">
			<label class="lab">fileinfo扩展：</label>
			<div class="ipt">
				&nbsp; &nbsp;
				<?php
				/*if (function_exists('finfo_open')){
					echo "<span style='color:green'><b>√</b></span>";
					} else {
					echo "<span  style='color:red'><b>×</b></span>";
					}*/
					?>
			</div>
		</div>	
		-->			



		<legend>目录权限检测</legend>
		<div class="formitm" style="width: 100%;">
			<label class="lab">可写：</label>
			<div class="ipt">
				data/ &nbsp; <?php $this->is_dir_write('data/');?>
				&nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; 
				application/ &nbsp; <?php  $this->is_dir_write('application/');?>
			</div>				
		</div>

		<div style="clear:both;width: 100%;padding:20px 0 0;color:#f00;text-align:center;">
			<?php if( $this->is_step!==true ){ ?>
				以上功能如果检测未通过会影响到系统使用，需修改服务器相关环境配置，通过后才可以继续安装。
			<?php } ?>
		</div>

	</div>
</div>

<div class="rj-foot">
	<a href="javascript:history.go(-1)">上一步</a>
	<?php
	if( $this->is_step==true ){
		?>
		<a href="<?php echo url(['install','index','step2']); ?>" class="submit">下一步</a>			
		<?php
	}else{
		?>
		<a href="" class="submit" style="cursor: not-allowed;background:#ccc">下一步</a>						
		<?php
	}
	?>
</div>

<?php require __DIR__ . '/inc_footer.tpl.php';?>
<style>
.rj_form legend{padding-top: 20px;}
.rj_form .formitm{width: 50%;float:left;}
.rj_form .formitm .ipt { margin-left: 130px; font-size: 12px;}
.rj_form .formitm .ipt span{ font-size: 14px;}
</style>